import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types'
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '来源单据编号',
    align:"center",
    dataIndex: 'srcBillCode'
   },
   {
    title: '单据类型',
    align:"center",
    dataIndex: 'billTypeName'
   },
   {
    title: '计划编号',
    align:"center",
    dataIndex: 'requisitionPlanCode'
   },
   {
    title: '创建时间',
    align:"center",
    dataIndex: 'createTime'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "计划编号",
      field: "requisitionPlanCode",
      component: 'Input',
      colProps: {span: 6},
 	},
	{
      label: "创建时间",
      field: "createTime",
      component: 'DatePicker',
      componentProps: {
         showTime:true,
         valueFormat: 'YYYY-MM-DD HH:mm:ss'
       },
      colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '单据类型ID',
    field: 'billTypeId',
    component: 'Input',
    show: false
  },
  {
    label: '单据类型',
    field: 'billTypeName',
    component: 'Input',
    // slot:'billTypeSlot',
    dynamicRules: () => {
      return [
        { required: true, message: '请选择单据类型!' },
      ];
    },
  },
  {
    label: '要货计划编码',
    field: 'requisitionPlanCode',
    component: 'Input',
  },
  {
    label: '计划员',
    field: 'schemer',
    component: 'JSelectUser',
    componentProps: ({ }) => {
      return {
        isRadioSelection: true,
        showButton: false
      }
    },
  },
  {
    label: '计划员id', 
    field: 'schemerId',
    component: 'Input',
    show:false
  },
  {
    label: '单号',
    field: 'srcBillId',
    component: 'Input',
    show: false
  },
  {
    label: '按供应商总汇',
    field: 'summarySupplier',
    component: 'Select',
    defaultValue:0,
    componentProps: {
      options: [{ value: 1, label: '是' }, { value: 0, label: '否' }],
      stringToNumber: true,
    },
  },
  {
    label: '按料品总汇',
    field: 'summaryMaterial',
    component: 'Select',
    defaultValue:0,
    componentProps: {
      options: [{ value: 1, label: '是' }, { value: 0, label: '否' }],
      stringToNumber: true,
    },
  },
  {
    label: '备注',
    field: 'remark',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];
//子表单数据
//子表表格配置
export const basRequisitionPlanSonColumns: JVxeColumn[] = [
    {
      title: '第三方编码',
      key: 'thirdPartyCode',
      type: JVxeTypes.hidden,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    // {
    //   title: '组织id',
    //   key: 'organizationId',
    //   type: JVxeTypes.input,
    //   width:"200px",
    //   placeholder: '请输入${title}',
    //   defaultValue:'',
    // },
    // {
    //   title: '租户id',
    //   key: 'tenantId',
    //   type: JVxeTypes.input,
    //   width:"200px",
    //   placeholder: '请输入${title}',
    //   defaultValue:'',
    // },
    // {
    //   title: '删除状态 0正常 1已删除',
    //   key: 'delFlag',
    //   type: JVxeTypes.input,
    //   width:"200px",
    //   placeholder: '请输入${title}',
    //   defaultValue:'',
    // },
    {
      title: '备注',
      key: 'remark',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '单据类型ID',
      key: 'billTypeId',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '单据类型名称',
      key: 'billTypeName',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '来源id',
      key: 'srcBillId',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '来源类型',
      key: 'srcBillType',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '来源单据编号',
      key: 'srcBillCode',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '来源行号',
      key: 'srcRowNumber',
      type: JVxeTypes.inputNumber,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '源头单据ID',
      key: 'firstBillId',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '源头单据编号',
      key: 'firstBillCode',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '源头单据类型ID',
      key: 'firstBillTypeId',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '源头单据类型名称',
      key: 'firstBillTypeName',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '行号',
      key: 'rowNumber',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '要货计划id',
      key: 'orderScheduleId',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '料号',
      key: 'objectId',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '产品Id',
      key: 'productId',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '产品名称',
      key: 'productName',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '需求日期',
      key: 'demandedDate',
      type: JVxeTypes.date,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '需求数量',
      key: 'quantityRequired',
      type: JVxeTypes.inputNumber,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
  ]


/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
// 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}